const editYears = (obj, val, offset) => {
    if (!(typeof obj == "object")) return;
    for (let k in obj) {
        if (obj[k].hasOwnProperty("years")) {
            const len = val
            const old_len = obj[k].years.data.length
            obj[k].years.number = val

            if (len < old_len) {
                obj[k].years.data.splice(len)
            } else if (len > old_len) {
                while (obj[k].years.data.length < len) {
                    obj[k].years.data.push(0)
                }
            }

            obj[k].years.offset = offset
            // obj[k].years.data = Array(val)
        } else {
            editYears(obj[k], val, offset)
        }
    }
}

const editBodys = (bodys, new_len, item) => {
    const len = new_len
    const old_len = bodys.length
    const name = item.name
    if (len < old_len) {
        bodys.splice(len)
    } else if (len > old_len) {
        while (bodys.length < len) {
            const new_itme = JSON.parse(JSON.stringify(item));
            new_itme.name = name + (bodys.length + 1)
            bodys.push(new_itme)
        }
    }
}

const Utils = {
    editYears: editYears,
    editBodys: editBodys
}

const constraint = {
    jsheq: (props, val) => {

        if (props.raw.info.data.jsheq.value !== props.raw.info.data.jsqjsy.value - props.raw.info.data.jsqqsy.value + 1) {
            props.raw.info.data.jsqqsy.value = 1
            props.raw.info.data.jsqjsy.value = props.raw.info.data.jsheq.value
        }

        let offset = 1
        // if (props.raw.info.data.jsheq.value % 12 === 0) {
        //     offset = parseInt(props.raw.info.data.jsheq.value / 12)
        // } else {
        //     offset = parseInt(props.raw.info.data.jsheq.value / 12) + 1
        // }

        Utils.editYears(props.raw.gfjycb.data.xlf, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfjycb.data.ywf, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.qtsr, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.sjl, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.zlzczc, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.zlfsr, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.jszrhsysr, parseInt(props.raw.info.data.xmyyq.value), offset)
        Utils.editYears(props.raw.gfsr.data.qysdssl, parseInt(props.raw.info.data.xmyyq.value), offset)
        for (let i in props.raw.gfjycb.data.qtfy.value.bodys) {
            Utils.editYears(props.raw.gfjycb.data.qtfy.value.bodys[i].data.qtfy, parseInt(props.raw.info.data.xmyyq.value), offset)
        }
    },
    jsqqsy: (props, val) => {
        props.raw.info.data.jsheq.value = props.raw.info.data.jsqjsy.value - props.raw.info.data.jsqqsy.value + 1
    },
    jsqjsy: (props, val) => {
        props.raw.info.data.jsheq.value = props.raw.info.data.jsqjsy.value - props.raw.info.data.jsqqsy.value + 1
    },
    zbjtrfs: (props, val) => {
        if (val.value == 0) {
            props.raw.info.data.zbjzxttzbl.show = true
            props.raw.info.data.zbjtrje.show = false

            props.raw.info.data.jsqlxjsfs.value.value = 0
            props.raw.info.data.jsqlx.show = false
        } else if (val.value == 1) {
            props.raw.info.data.zbjzxttzbl.show = false
            props.raw.info.data.zbjtrje.show = true

            props.raw.info.data.jsqlxjsfs.value.value = 1
            props.raw.info.data.jsqlx.show = true

        } else {
            console.log("constraint -> zbjtrfs error")
        }
    },
    jsqlxjsfs: (props, val) => {
        if (val.value == 0) {
            props.raw.info.data.jsqlx.show = false

            props.raw.info.data.zbjtrfs.value.value = 0
            props.raw.info.data.zbjzxttzbl.show = true
            props.raw.info.data.zbjtrje.show = false
        } else if (val.value == 1) {
            props.raw.info.data.jsqlx.show = true

            props.raw.info.data.zbjtrfs.value.value = 1
            props.raw.info.data.zbjzxttzbl.show = false
            props.raw.info.data.zbjtrje.show = true
        } else {
            console.log("constraint -> jsqlx error")
        }
    },
    hzqygs: (props, val) => {
        const O = Array(parseInt(val))
        for (let i = 0; i < parseInt(val); i++) {
            O[i] = {
                name: "投资者" + (i + 1),
                value: 100 / parseInt(val)
            }
        }
        props.raw.zyzjly.data.gfbl.value.kvs = O

        Utils.editBodys(props.raw.zlzcjsr.data.tzf.value.bodys, parseInt(val), {
            name: "投资方",
            data: {
                // zlzczc: {
                //     name: "租赁资产支出(万元)",
                //     type: 2,
                //     value: {
                //         years: {
                //             number: parseInt(1),
                //             data: Array(1)
                //         }
                //     },
                //     disable: false,
                //     show: true
                // },
                zlfsr: {
                    name: "租赁费收入(万元)",
                    type: 2,
                    value: {
                        years: {
                            number: parseInt(1),
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
                jszrhsysr: {
                    name: "技术转让或使用收入",
                    type: 2,
                    value: {
                        years: {
                            number: parseInt(1),
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                }
            }
        })

    },
    dkyhgs: (props, val) => {
        Utils.editBodys(props.raw.rzzjly.data.yh.value.bodys, parseInt(val), {
            name: "银行",
            data: {
                rzbli: {
                    name: "融资比例(%)",
                    type: 0,
                    value: 0,
                    disable: false,
                    show: true
                },
                ydhkq: {
                    name: "预定还款期(年)",
                    type: 0,
                    value: 1,
                    disable: false,
                    show: true
                },
                kxq: {
                    name: "宽限期(年)",
                    type: 0,
                    value: 4,
                    disable: false,
                    show: true
                },
                jxcs: {
                    name: "计息次数",
                    type: 0,
                    value: 1,
                    disable: false,
                    show: true
                },
                hbfxfs: {
                    name: "还本付息方式",
                    type: 1,
                    value: {
                        options: [
                            { label: "等额还本付息", value: 0 },
                            { label: "等额还本利息照付", value: 1 },
                            { label: "约定还款", value: 2 }
                        ],
                        value: 0
                    },
                    disable: false,
                    show: true
                },
                // hbje: {
                //     name: "还本金额(万元)",
                //     type: 2,
                //     value: {
                //         years: {
                //             number: parseInt(1),
                //             data: Array(1)
                //         }
                //     },
                //     disable: false,
                //     show: true
                // },
                // cqdkll: {
                //     name: "长期贷款利率(%)",
                //     type: 2,
                //     value: {
                //         years: {
                //             number: 1,
                //             data: Array(1)
                //         }
                //     },
                //     disable: false,
                //     show: true
                // }
            }
        })
    },
    hbfxfs: (props, val) => {
        if (val.value == 2) {
            props.raw.ldzjjdk.data.hbje.show = true
        } else {
            props.raw.ldzjjdk.data.hbje.show = false

        }
    },
    ldzjjsfs: (props, val) => {
        if (val.value == 0) {
            props.raw.ldzjjdk.data.dwqwzb.show = true
            props.raw.ldzjjdk.data.ldzj.show = false
        } else if (val.value == 1) {
            props.raw.ldzjjdk.data.dwqwzb.show = false
            props.raw.ldzjjdk.data.ldzj.show = true
        }
    },
    ydfyx: (props, val) => {
        Utils.editBodys(props.raw.cnjycb.data.ydfy.value.bodys, parseInt(val), {
            name: "用电费用",
            data: {
                mwh: {
                    name: "MWh",
                    type: 2,
                    value: {
                        years: {
                            number: 3,
                            data: Array(3)
                        }
                    },
                    disable: false,
                    show: true
                },
                kwh: {
                    name: "元/kWh (含税)",
                    type: 2,
                    value: {
                        kvs: [
                            { name: "进项税率(%)", value: 0 }
                        ],
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                }
            }
        })
    },
    qtcwfyx: (props, val) => {
        Utils.editBodys(props.raw.qtcwfy.data.qtcwfy.value.bodys, parseInt(val), {
            name: "其他财务费用",
            data: {
                wy: {
                    name: "万元",
                    type: 2,
                    value: {
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
            }
        })
    },
    qtsrx: (props, val) => {
        Utils.editBodys(props.raw.qtsr.data.qtsr.value.bodys, parseInt(val), {
            name: "其他收入",
            data: {
                cl: {
                    name: "产量(MWh)",
                    type: 2,
                    value: {
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
                dj: {
                    name: "单价-含税(元/MWh)",
                    type: 2,
                    value: {
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
                xxsl: {
                    name: "销项税率(%)",
                    type: 2,
                    value: {
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
                zzsjzjtbl: {
                    name: "增值税即征即退比例(%)",
                    type: 2,
                    value: {
                        years: {
                            number: 1,
                            data: Array(1)
                        }
                    },
                    disable: false,
                    show: true
                },
            }
        })
    },

    // -----------------
    gdzcbl: (props, val) => {
        // console.log("gdzcbl", val)
        if (parseFloat(val) === 0) {
            props.raw.info.data.gdzcbl.value = 0
            return
        }
        if (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value) + parseFloat(val) >= 100) {
            props.raw.info.data.gdzcbl.value = 100 - (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value))
        }
        if (parseFloat(props.raw.info.data.wxzcbl.value) * parseFloat(props.raw.info.data.qtzcbl.value) > 0) {
            props.raw.info.data.gdzcbl.value = 100 - (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value))
        }
    },
    wxzcbl: (props, val) => {
        if (parseFloat(val) === 0) {
            props.raw.info.data.wxzcbl.value = 0
            return
        }
        if (parseFloat(props.raw.info.data.gdzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value) + parseFloat(val) >= 100) {
            props.raw.info.data.wxzcbl.value = 100 - (parseFloat(props.raw.info.data.gdzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value))
        }
        if (parseFloat(props.raw.info.data.gdzcbl.value) * parseFloat(props.raw.info.data.qtzcbl.value) > 0) {
            props.raw.info.data.wxzcbl.value = 100 - (parseFloat(props.raw.info.data.gdzcbl.value) + parseFloat(props.raw.info.data.qtzcbl.value))
        }
    },
    qtzcbl: (props, val) => {
        if (parseFloat(val) === 0) {
            props.raw.info.data.qtzcbl.value = 0
            return
        }
        if (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.gdzcbl.value) + parseFloat(val) >= 100) {
            props.raw.info.data.qtzcbl.value = 100 - (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.gdzcbl.value))
        }
        if (parseFloat(props.raw.info.data.wxzcbl.value) * parseFloat(props.raw.info.data.gdzcbl.value) > 0) {
            props.raw.info.data.qtzcbl.value = 100 - (parseFloat(props.raw.info.data.wxzcbl.value) + parseFloat(props.raw.info.data.gdzcbl.value))
        }
    },
    qtfyx: (props, val) => {
        Utils.editBodys(props.raw.gfjycb.data.qtfy.value.bodys, parseInt(val), {
            name: "其他费用",
            data: {
                qtfy: {
                    name: {
                        options: [
                            { label: "元/kW", value: 0 },
                            { label: "元/MW", value: 1 }
                        ],
                        value: 0
                    },
                    type: 3,
                    value: {
                        select: {
                            options: [
                                { label: "手动输入", value: 0 },
                                { label: "各年相同", value: 1 }
                            ],
                            value: 0
                        },
                        years: {
                            number: parseInt(props.raw.info.data.xmyyq.value),
                            data: Array(parseInt(props.raw.info.data.xmyyq.value),),
                            offset: parseInt(parseInt(props.raw.info.data.xmyyq.value) / 12)
                        }
                    },
                    disable: false,
                    show: true
                }
            }
        })
    },
    xmyyq: (props, val) => {

        let offset = 1
        // if (props.raw.info.data.jsheq.value % 12 === 0) {
        //     offset = parseInt(props.raw.info.data.jsheq.value / 12)
        // } else {
        //     offset = parseInt(props.raw.info.data.jsheq.value / 12) + 1
        // }

        Utils.editYears(props.raw.gfjycb.data.xlf, parseInt(val), offset)
        Utils.editYears(props.raw.gfjycb.data.ywf, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.qtsr, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.sjl, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.zlzczc, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.zlfsr, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.jszrhsysr, parseInt(val), offset)
        Utils.editYears(props.raw.gfsr.data.qysdssl, parseInt(val), offset)
        for (let i in props.raw.gfjycb.data.qtfy.value.bodys) {
            Utils.editYears(props.raw.gfjycb.data.qtfy.value.bodys[i].data.qtfy, parseInt(val), offset)
        }
    },
    zlczjrl: (props, val) => {
        // props.raw.info.data.fndtz.value = 0
        // props.raw.info.data.dwkwjttz.value = 0
        props.raw.info.data.dwkwjttz.value = props.raw.info.data.fndtz.value * 10 / props.raw.info.data.zlczjrl.value
    },
    dwkwjttz: (props, val) => {
        // console.log("dwkwjttz",val)
        // props.raw.info.data.fndtz.value = parseFloat(val) * props.raw.info.data.zlczjrl.value / 10
        props.raw.info.data.dwkwjttz.value = parseFloat(props.raw.info.data.dwkwjttz.value).toFixed(2)
    },
    fndtz: (props, val) => {
        // console.log("fndtz",val)
        props.raw.info.data.dwkwjttz.value = parseFloat(val) * 10 / props.raw.info.data.zlczjrl.value
    },
    qtsr: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfsr.data.qtsr.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    zlzczc: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfsr.data.zlzczc.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    zlfsr: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfsr.data.zlfsr.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    jszrhsysr: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfsr.data.jszrhsysr.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    qysdssl: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.sl.data.qysdssl.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    sjl: (props, val, payload) => {
        // console.log("qtsr", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfsr.data.sjl.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    ywf: (props, val, payload) => {
        // console.log("ywf", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfjycb.data.ywf.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    xlf: (props, val, payload) => {
        // console.log("xlf", val, payload)
        if (payload === undefined || payload === null || payload === '') {
            return
        }
        if (val.select.value === 1) {
            for (let i = 0; i < props.raw.gfjycb.data.xlf.value.years.data.length; i++) {
                val.years.data[i] = val.years.data[payload]
            }
        }
    },
    qtfy: (props, val, payload) => {
        // console.log("qtfy --- >", val, payload)
        if (val.hasOwnProperty("bodys")) {
            console.log("bodys", val.bodys)
        } else {
            if (payload === undefined || payload === null || payload === '') {
                return
            }
            if (val.select.value === 1) {
                for (let i = 0; i < val.years.data.length; i++) {
                    val.years.data[i] = val.years.data[payload]
                }
            }
        }
    },
    bwms: (props, val) => {
        // console.log("bwms", val.value)
        val = parseInt(val.value)
        if (val === 0) {
            props.raw.gfsr.data.zfzybl.show = true
            props.raw.gfsr.data.swdj.show = true
            props.raw.gfsr.data.zydj.show = true

            props.raw.gfsr.data.swdj_show.value = (props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.zydj.value + (1 - props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.swdj.value
        } else if (val === 1) {
            props.raw.gfsr.data.zfzybl.show = false
            props.raw.gfsr.data.swdj.show = true
            props.raw.gfsr.data.zydj.show = false

            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.swdj.value
        } else if (val === 2) {
            props.raw.gfsr.data.zfzybl.show = false
            props.raw.gfsr.data.swdj.show = false
            props.raw.gfsr.data.zydj.show = true

            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.zydj.value
        }
    },
    zfzybl: (props, val) => {
        if (props.raw.gfsr.data.bwms.value.value === 0) {
            props.raw.gfsr.data.swdj_show.value = (props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.zydj.value + (1 - props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.swdj.value
        }
    },
    swdj: (props, val) => {
        if (props.raw.gfsr.data.bwms.value.value === 1) {
            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.swdj.value
        } else if (props.raw.gfsr.data.bwms.value.value === 2) {
            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.zydj.value
        } else {
            props.raw.gfsr.data.swdj_show.value = (props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.zydj.value + (1 - props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.swdj.value
        }
    },
    zydj: (props, val) => {
        if (props.raw.gfsr.data.bwms.value.value === 1) {
            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.swdj.value
        } else if (props.raw.gfsr.data.bwms.value.value === 2) {
            props.raw.gfsr.data.swdj_show.value = props.raw.gfsr.data.zydj.value
        } else {
            props.raw.gfsr.data.swdj_show.value = (props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.zydj.value + (1 - props.raw.gfsr.data.zfzybl.value / 100) * props.raw.gfsr.data.swdj.value
        }
    },
    kdksjjsfs: (props, val) => {
        if (parseInt(val.value) === 0) {
            props.raw.info.data.kdksj.show = true
            props.raw.info.data.sbf.show = false
            props.raw.info.data.jagcf.show = false
            props.raw.info.data.kdksj_qtfy.show = false
            props.raw.info.data.jszdzdfy.show = false

            props.raw.info.data.kdksj_show.value = props.raw.info.data.kdksj.value
        } else {
            props.raw.info.data.kdksj.show = false
            props.raw.info.data.sbf.show = true
            props.raw.info.data.jagcf.show = true
            props.raw.info.data.kdksj_qtfy.show = true
            props.raw.info.data.jszdzdfy.show = true

            let x = props.raw.info.data.sbf.value
            let y = props.raw.info.data.jagcf.value
            let z = props.raw.info.data.kdksj_qtfy.value
            let u = props.raw.info.data.jszdzdfy.value
            let a = (x / 1.13) * 0.13;
            let b = (y / 1.09) * 0.09;
            let c = ((z - u) * 0.55) / 1.06 * 0.06;
            let res = a + b + c;
            props.raw.info.data.kdksj_show.value = res
        }
    },
    kdksj: (props, val) => {
        props.raw.info.data.kdksj_show.value = val
    },
    sbf: (props, val) => {
        if (props.raw.info.data.kdksjjsfs.value.value === 1) {
            let x = props.raw.info.data.sbf.value
            let y = props.raw.info.data.jagcf.value
            let z = props.raw.info.data.kdksj_qtfy.value
            let u = props.raw.info.data.jszdzdfy.value
            let a = (x / 1.13) * 0.13;
            let b = (y / 1.09) * 0.09;
            let c = ((z - u) * 0.55) / 1.06 * 0.06;
            let res = a + b + c;
            props.raw.info.data.kdksj_show.value = res
        }
    },
    jagcf: (props, val) => {
        if (props.raw.info.data.kdksjjsfs.value.value === 1) {
            let x = props.raw.info.data.sbf.value
            let y = props.raw.info.data.jagcf.value
            let z = props.raw.info.data.kdksj_qtfy.value
            let u = props.raw.info.data.jszdzdfy.value
            let a = (x / 1.13) * 0.13;
            let b = (y / 1.09) * 0.09;
            let c = ((z - u) * 0.55) / 1.06 * 0.06;
            let res = a + b + c;
            props.raw.info.data.kdksj_show.value = res
        }
    },
    kdksj_qtfy: (props, val) => {
        if (props.raw.info.data.kdksjjsfs.value.value === 1) {
            let x = props.raw.info.data.sbf.value
            let y = props.raw.info.data.jagcf.value
            let z = props.raw.info.data.kdksj_qtfy.value
            let u = props.raw.info.data.jszdzdfy.value
            let a = (x / 1.13) * 0.13;
            let b = (y / 1.09) * 0.09;
            let c = ((z - u) * 0.55) / 1.06 * 0.06;
            let res = a + b + c;
            props.raw.info.data.kdksj_show.value = res
        }
    },
    jszdzdfy: (props, val) => {
        if (props.raw.info.data.kdksjjsfs.value.value === 1) {
            let x = props.raw.info.data.sbf.value
            let y = props.raw.info.data.jagcf.value
            let z = props.raw.info.data.kdksj_qtfy.value
            let u = props.raw.info.data.jszdzdfy.value
            let a = (x / 1.13) * 0.13;
            let b = (y / 1.09) * 0.09;
            let c = ((z - u) * 0.55) / 1.06 * 0.06;
            let res = a + b + c;
            props.raw.info.data.kdksj_show.value = res
        }
    },
    sfzxsmsjbzc: (props, val) => {
        if (val.value === 0) {//是
            props.raw.gfsr.data.mjns.show = true
            props.raw.gfsr.data.jbns.show = true
        } else if (val.value === 1) {//否
            props.raw.gfsr.data.mjns.show = false
            props.raw.gfsr.data.jbns.show = false
            props.raw.gfsr.data.mjns.value = 0
            props.raw.gfsr.data.jbns.value = 0
        }
    },
    sjljsfs: (props, val) => {
        if (val.value === 0) {
            props.raw.gfsr.data.tysnsjl.show = true
            props.raw.gfsr.data.znsjl.show = true
            props.raw.gfsr.data.sjl.show = false
        } else if (val.value === 1) {
            props.raw.gfsr.data.tysnsjl.show = false
            props.raw.gfsr.data.znsjl.show = false
            props.raw.gfsr.data.tysnsjl.value = props.raw.gfsr.data.tysnsjl.value || 0
            props.raw.gfsr.data.znsjl.value = props.raw.gfsr.data.znsjl.value || 0
            props.raw.gfsr.data.sjl.show = true
        }
    }
}

export default constraint